package ooday04;

@SuppressWarnings({"all"})
public class Test2 {
    public static void main(String[] args) {
        Animal[] animals=new Animal[3];
        animals[0]=new Dog("1",2,"3");
        animals[1]=new Dog("2",2,"3");
        animals[2]=new Dog("2",2,"3");
        for (int i = 0; i <animals.length ; i++) {
            System.out.println(animals[i].name);
            animals[i].eat();
            animals[i].drink();
            if (animals[i] instanceof Dog){
                 Dog dog=(Dog) animals[i];
                 dog.lookHome();
            }
            if (animals[i] instanceof Chick){
                Chick chick=(Chick) animals[i];
                chick.layEggs();
            }
            if (animals[i] instanceof swim) {
                swim swim=(ooday04.swim) animals[i];
                swim.swimming();
            }
            System.out.println("====");
        }

    }


}
